package com.activenetwork.smlite.page.rfp.RfpMaintenanceView;

import org.openqa.selenium.WebDriver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.activenetwork.custom.uielement.UIElement;
import com.activenetwork.custom.uielement.decorate.InJson;
import com.activenetwork.smlite.page.event.EventDetailView.EventSourceSubview;
import com.activenetwork.smlite.page.rfp.RfpBasicsSubview;
import com.activenetwork.smlite.page.rfp.ViewRFPDetailTemplate;
import com.activenetwork.util.EnvContext;
import com.activenetwork.util.PageLoader;
import com.activenetwork.util.WaitUtil;
import com.activenetwork.util.WindowLoader;

public class RfpReview extends RfpBasicsSubview {
	private Logger logger = LoggerFactory.getLogger(RfpReview.class);
	
	@InJson
	private UIElement sendBtn;
	@InJson
	private UIElement viewRfpDetail;
	
	/**
	 * Click send rfp button
	 * @return
	 */
	public EventSourceSubview sendRfp(){
		logger.info("Send rfp");
		sendBtn.click();
		return PageLoader.load(EventSourceSubview.class);
	}
	/**
	 * Click view rfp detail link
	 * Will pop up the window
	 * @return
	 */
	public ViewRFPDetailTemplate viewRfpDetail(WindowLoader windowLoader){
		WebDriver driver = EnvContext.webDriverTL.get();
		WaitUtil waitUtil = new WaitUtil();
		viewRfpDetail.click();
		waitUtil.wait(2000);
		windowLoader.switchWindow(driver);
		return PageLoader.load(ViewRFPDetailTemplate.class);
	}
}
